package di

import (
	"github.com/google/wire"
	"github.com/micro/go-micro/v2/util/log"
)

//防止没有实现接口所有方法
var _ IGreeter = (*Greeter)(nil)

type Message string
type Greeter struct {
	msg Message
}

type Event struct {
	greeter IGreeter
	sender Sender
}

type Sender struct {

}

func NewMessage(msg string) (Message)  {
	return Message(msg)
}

func NewGreeter(message Message) (Greeter) {
	return Greeter{message}
}

func NewEvent(greeter IGreeter) (Event ,error) {
	return Event{greeter: greeter}, nil
}

func (e Event)Start()  {
	e.greeter.Say()
}

func (g Greeter)Say()  {
	log.Info(g.msg)
}

type IGreeter interface {
	Say()
}

var MyGreeer = wire.NewSet(wire.Struct(new(Greeter),"*"), wire.Bind(new(IGreeter), new(*Greeter)))
